<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" src="../css/jquery-3.3.1.min.js"></script>
</head>
<body>
<form>
    支出内容:<input type="text" name="content" id="content"><br>
    支出金额:<input type="number" name="expend" id="expend">
</form>

</table>
<button type="button" id="comfirm">确定</button>
</body>
<script>
    $(function () {
        $("#comfirm").click(function () {
            var content = $("#content").val();
            var expend = $("#expend").val();
            if(content == ''|| expend == ''){
                alert("请输入数据再提交");
                return;
            }
               $.ajax({
                   type:'POST',
                   url:'../expend/addExpend.action?content='+content+'&expend='+expend,
                   success:function(result){
                      if(result !=null){
                          alert(result);
                          window.location.href = '../expend/expendList.action';
                      }
                   }
               });
        });
    });

</script>
</html>

